package com.example.demo.service.impl;

import com.example.demo.dao.UserDao;
import com.example.demo.model.Result;
import com.example.demo.model.User;
import com.example.demo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 具体实现类，定义的接口
 * */
@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User getUserById(Integer id) {
        return userDao.getUserById(id);
    }

    @Override
    public void insertUser(User user) {
        userDao.insertUser(user);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateUser(user);
    }

    @Override
    public void deleteUser(Integer id) {
        userDao.deleteUser(id);
    }

    @Override
    public User login(String username,String password) {
        return userDao.login(username, password);
    }

    @Override
    public void regist(String username,String password) {
        return;
    }

    @Override
    public User getUserByName(String username) {
        return userDao.getUserByName(username);
    }
}
